package com.ymatou.iapi.godmch.testcase;

import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import sun.reflect.generics.tree.Tree;

import com.ymatou.iapi.godmch.parameter.applySupplierBean;
import com.ymatou.iapi.godmch.parameter.createIndepMchBean;
import com.ymatou.iapi.godmch.parameter.editSupplierBean;
import com.ymatou.iapi.godmch.service.applySupplierCall;
import com.ymatou.iapi.godmch.service.createIndepMchCall;
import com.ymatou.iapi.godmch.service.editSupplierCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.godmch.supplierInfo;
import com.ymttest.database.model.godmch.supplierInfoExample;
import com.ymttest.database.sqlwapper.godmch.supplierInfoWapper;
import com.ymttest.utils.TestDataManager;
/**
*编辑供货商
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_editSupplier{
	private static editSupplierBean bean;
	private static editSupplierCall call;
	private  supplierInfoExample supplierInfoExample=new supplierInfoExample();
	private  supplierInfoWapper supplierInfoWapper=new supplierInfoWapper();
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("编辑供货商");
	}

	@Before
	public void caseUp() {
		bean=new editSupplierBean();
		call=new editSupplierCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	private void check_verify() throws InterruptedException {
		
		supplierInfoExample.clear();
		supplierInfoExample.createCriteria().andMchIdEqualTo(bean.getMchId()).andSupplierIdEqualTo(bean.getSupplierId());
		supplierInfo supplierInfo=supplierInfoWapper.selectByExample(supplierInfoExample).get(0);
		Logger.verifyEquals("200", call.getStatusCode1(), "验证status");
		Logger.verifyEquals(true, call.getMessage().contains("请求成功"), "验证Message");
		Logger.verifyEquals(bean.getDepot()==null?"":bean.getDepot(), supplierInfo.getDepot(), "验证修改的Depot与数据库Depot一致");
		Logger.verifyEquals(bean.getRemark()==null?"":bean.getRemark(), supplierInfo.getRemark(), "验证修改的Remark与数据库Remark一致");
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_001() {
		Logger.start(true,"正例-编辑供货商-独立商户id是无代理独立商户-编辑仓库名称-成功");
		try {
			//创建独立商户1
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //同意
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(applySupplierBean.getMchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot("自动化测试编辑供货商仓库名称_"+TestDataManager.getRandomIntNum(5));
          //  bean.setRemark("自动化测试备注_"+TestDataManager.getRandomIntNum(5));
            
			call.setData(bean);
			call.callService();			
			
			check_verify();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_002() {
		Logger.start(true,"正例-编辑供货商-独立商户id是无代理独立商户-编辑备注-成功");
		try {
			//创建独立商户1
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //同意
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(applySupplierBean.getMchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
           // bean.setDepot("自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();	
			
			check_verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_002_1() {
		Logger.start(true,"正例-编辑供货商-独立商户id是无代理独立商户-审核状态：删除-编辑备注-失败");
		try {
			//创建独立商户1
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //同意
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            //删除
            GodmchManageCallService.deleteSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(applySupplierBean.getMchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot("自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			
			Logger.verifyEquals("5000", call.getStatusCode1(), "验证status");
			Logger.verifyEquals(true, call.getMessage().contains("供货关系不存在"), "验证Message");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_002_2() {
		Logger.start(true,"正例-编辑供货商-独立商户id是无代理独立商户-审核状态:拒绝-编辑备注-失败");
		try {
			//创建独立商户1
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //拒绝
            GodmchManageCallService.rejectSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(applySupplierBean.getMchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
           // bean.setDepot("自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			
			Logger.verifyEquals("5000", call.getStatusCode1(), "验证status");
			Logger.verifyEquals(true, call.getMessage().contains("供货关系不存在"), "验证Message");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_002_3() {
		Logger.start(true,"正例-编辑供货商-独立商户id是无代理独立商户-审核状态:重新申请-编辑备注-失败");
		try {
			//创建独立商户1
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //拒绝
            GodmchManageCallService.rejectSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            //重新申请
            GodmchManageCallService.ReApplySupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(applySupplierBean.getMchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot("自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			
			Logger.verifyEquals("5000", call.getStatusCode1(), "验证status");
			Logger.verifyEquals(true, call.getMessage().contains("供货关系不存在"), "验证Message");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_002_4() {
		Logger.start(true,"正例-编辑供货商-独立商户id是无代理独立商户-审核状态:重新拒绝-编辑备注-失败");
		try {
			//创建独立商户1
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //拒绝
            GodmchManageCallService.rejectSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            //重新申请
            GodmchManageCallService.ReApplySupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            //拒绝
            GodmchManageCallService.rejectSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(applySupplierBean.getMchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot("自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			
			Logger.verifyEquals("5000", call.getStatusCode1(), "验证status");
			Logger.verifyEquals(true, call.getMessage().contains("供货关系不存在"), "验证Message");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_002_5() {
		Logger.start(true,"正例-编辑供货商-独立商户id是无代理独立商户-审核状态:删除重新申请被拒绝-编辑备注-失败");
		try {
			//创建独立商户1
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //删除
            GodmchManageCallService.deleteSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            //重新申请
            GodmchManageCallService.ReApplySupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            //拒绝
            GodmchManageCallService.rejectSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(applySupplierBean.getMchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot("自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			
			Logger.verifyEquals("5000", call.getStatusCode1(), "验证status");
			Logger.verifyEquals(true, call.getMessage().contains("供货关系不存在"), "验证Message");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_002_6() {
		Logger.start(true,"正例-编辑供货商-独立商户id是无代理独立商户-删除重新申请通过-编辑备注-成功");
		try {
			//创建独立商户1
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //同意
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            //删除
            GodmchManageCallService.deleteSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            //重新申请
            GodmchManageCallService.ReApplySupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            //通过
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(applySupplierBean.getMchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot("自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			
			check_verify();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_002_7() {
		Logger.start(true,"正例-编辑供货商-独立商户id是无代理独立商户-拒绝重新申请通过-编辑备注-成功");
		try {
			//创建独立商户1
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //拒绝
            GodmchManageCallService.rejectSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            //重新申请
            GodmchManageCallService.ReApplySupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            //通过
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(applySupplierBean.getMchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot("自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			
			check_verify();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_004() {
		Logger.start(true,"正例-编辑供货商-独立商户id是有代理独立商户-编辑备注-成功");
		try {
			//创建独立商户1
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //代理
            GodmchManageCallService.applyAndapproveAgent(createIndepMchCall.getmchId());
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //通过
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(applySupplierBean.getMchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            //bean.setDepot("自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			
			check_verify();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_008() {
		Logger.start(true,"正例-编辑供货商-depot和remark同时为空-成功");
		try {
			//创建独立商户
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请独立商户的代理
            GodmchManageCallService.applyAndapproveAgent(createIndepMchCall.getmchId());
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //通过
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
    		
            bean.setMchId(createIndepMchCall.getmchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
			call.setData(bean);
			call.callService();			
			//20200407 修改 可以同时为空
			//Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");
			check_verify();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_009() {
		Logger.start(true,"正例-编辑供货商-无改变编辑内容-成功");
		try {
			//创建独立商户
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请独立商户的代理
            GodmchManageCallService.applyAndapproveAgent(createIndepMchCall.getmchId());
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //通过
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());

            bean.setMchId(createIndepMchCall.getmchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot("自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
		    
			call.callService();	
			
	    	check_verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_009_1() {
		Logger.start(true,"正例-编辑供货商-一个独立商户下的两个供货商的仓库名称相同-失败");
		try {
			String dept="自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5);
			//创建独立商户
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请供货商1
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //通过1
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(createIndepMchCall.getmchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot(dept);
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();	
			
            //申请供货商2
            applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //通过2
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());

            bean.setMchId(createIndepMchCall.getmchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot(dept);
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			
			Logger.verifyEquals("5000", call.getStatusCode1(), "验证status");
			Logger.verifyEquals(true, call.getMessage().contains("仓库名称必须唯一"), "验证Message");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_009_2() {
		Logger.start(true,"正例-编辑供货商-两个独立商户下的一个供货商的仓库名称相同-成功(相同独立商户下的仓库名称不能一致)");
		try {
			String dept="自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5);
			//创建独立商户
			createIndepMchBean createIndepMchBean1=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall1=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean1);
            //申请供货商1
            applySupplierBean applySupplierBean1=GodmchManageCallService.initApplySupplier(createIndepMchCall1.getmchId());
            applySupplierCall applySupplierCall1=GodmchManageCallService.applySupplierCall(applySupplierBean1);
            //通过1
            GodmchManageCallService.approveSupplier(createIndepMchCall1.getmchId(), applySupplierCall1.getSupplierId());
            
            bean.setMchId(createIndepMchCall1.getmchId());
            bean.setSupplierId(applySupplierCall1.getSupplierId());
            bean.setDepot(dept);
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();	
			
			//创建独立商户2
			createIndepMchBean createIndepMchBean2=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall2=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean2);
            //申请供货商2
            applySupplierBean applySupplierBean2=GodmchManageCallService.initApplySupplier(createIndepMchCall2.getmchId());
            applySupplierCall applySupplierCall2=GodmchManageCallService.applySupplierCall(applySupplierBean2);
            //通过2
            GodmchManageCallService.approveSupplier(createIndepMchCall2.getmchId(), applySupplierCall2.getSupplierId());

            bean.setMchId(createIndepMchCall2.getmchId());
            bean.setSupplierId(applySupplierCall2.getSupplierId());
            bean.setDepot(dept);
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			
			check_verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_010() {
		Logger.start(true,"正例-编辑供货商-独立商户与供货商不存在关系-失败");
		try {
			//创建独立商户1
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
           //创建独立商户2
			createIndepMchBean createIndepMchBean2=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall2=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean2);
            //申请独立商户的代理
            GodmchManageCallService.applyAndapproveAgent(createIndepMchCall.getmchId());
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //通过
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(createIndepMchCall2.getmchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot("自动化测试仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试编辑供货商备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			
			Logger.verifyEquals("5000", call.getStatusCode1(), "验证status");
			Logger.verifyEquals(true, call.getMessage().contains("供货关系不存在"), "验证msg");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_013() {
		Logger.start(true,"正例-编辑供货商-mchId不存在-失败");
		try {
			//创建独立商户
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请独立商户的代理
            GodmchManageCallService.applyAndapproveAgent(createIndepMchCall.getmchId());
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //通过
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(createIndepMchCall.getmchId()+9999);
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot("自动化测试编辑供货商仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			Logger.verifyEquals("5000", call.getStatusCode1(), "验证status");
			Logger.verifyEquals(true, call.getMessage().contains("供货关系不存在"), "验证msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_014() {
		Logger.start(true,"正例-编辑供货商-supplierId不存在-失败");
		try {
			//创建独立商户
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请独立商户的代理
            GodmchManageCallService.applyAndapproveAgent(createIndepMchCall.getmchId());
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //通过
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(createIndepMchCall.getmchId());
            bean.setSupplierId(applySupplierCall.getSupplierId()+999);
            bean.setDepot("自动化测试编辑供货商仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			Logger.verifyEquals("5000", call.getStatusCode1(), "验证status");
			Logger.verifyEquals(true, call.getMessage().contains("供货关系不存在"), "验证msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_015() {
		Logger.start(true,"正例-编辑供货商-mchId为空-失败");
		try {
			//创建独立商户
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请独立商户的代理
            GodmchManageCallService.applyAndapproveAgent(createIndepMchCall.getmchId());
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //通过
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
           // bean.setMchId(createIndepMchCall.getmchId());
            bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot("自动化测试编辑供货商仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_editSupplier_016() {
		Logger.start(true,"正例-编辑供货商-supplierId为空-失败");
		try {
			//创建独立商户
			createIndepMchBean createIndepMchBean=GodmchManageCallService.InitCreateIndepMchBean();
            createIndepMchCall createIndepMchCall=GodmchManageCallService.CreateIndepMchCall(createIndepMchBean);
            //申请独立商户的代理
            GodmchManageCallService.applyAndapproveAgent(createIndepMchCall.getmchId());
            //申请供货商
            applySupplierBean applySupplierBean=GodmchManageCallService.initApplySupplier(createIndepMchCall.getmchId());
            applySupplierCall applySupplierCall=GodmchManageCallService.applySupplierCall(applySupplierBean);
            //通过
            GodmchManageCallService.approveSupplier(createIndepMchCall.getmchId(), applySupplierCall.getSupplierId());
            
            bean.setMchId(createIndepMchCall.getmchId());
            //bean.setSupplierId(applySupplierCall.getSupplierId());
            bean.setDepot("自动化测试编辑供货商仓库名称_"+TestDataManager.getRandomIntNum(5));
            bean.setRemark("自动化测试备注_"+TestDataManager.getRandomIntNum(5));
			call.setData(bean);
			call.callService();			
			Logger.verifyEquals("4001", call.getStatusCode1(), "验证status");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}